package lining;
// Lineup.java
//
// Informatics 102 Spring 2012
// Code Example
//
// This is the Lineup class, without any validation of slot numbers.  Note
// that Lineups will still validate the slot numbers passed to them, but
// that the validation will be performed by code we'll write in a separate
// aspect called LineupSlotValidation.  One nice thing about separating our
// validation code is that the methods in this class become short and simple,
// with no visual noise associated with parameter validation.

public class Lineup
{
	private Player slots[];
	
	
	public Lineup()
	{
		// We'll create an array of 10 elements, so that we can use the
		// cells indexed 1 through 9 to represent the players in the lineup,
		// with cell 0 being empty space.  (This prevents us from having to
		// translate our slot numbers to array indices by, say, subtracting 1
		// from them.)
		slots = new Player[10];
	}
	
	
	public Player getPlayerInSlot(int slotNumber)
	{
		return slots[slotNumber];
	}
	
	
	public void putPlayerIntoSlot(int slotNumber, Player player)
	{
		slots[slotNumber] = player;
	}
	
	
	public void swapPlayers(int slotNumber1, int slotNumber2)
	{
		Player temp = slots[slotNumber1];
		slots[slotNumber1] = slots[slotNumber2];
		slots[slotNumber2] = temp;
	}
}
